//
//  SinaViewController.m
//  Focus
//
//  Created by dlios on 14-11-10.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "SinaViewController.h"

@interface SinaViewController ()

@end

@implementation SinaViewController
-(void)dealloc{
    [super dealloc];
    [_myid release];
    [_webView release];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, self.view.frame.size.height)];
    NSString *str = [NSString stringWithFormat:@"http://weibo.com/u/%@",self.myid];
    NSURL *url = [NSURL URLWithString:str];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
    self.webView.delegate = self;
    self.webView.scrollView.bounces = YES;
    //自动缩放页面以适应屏幕
    [self.webView setScalesPageToFit:YES];
    [self.view addSubview:self.webView];
    [self.webView reload];
    [self.webView setUserInteractionEnabled:YES];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height - 48, 320, 40)];
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 5, 40, 30);
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [button setImage:[UIImage imageNamed:@"circle_icon_quit.png"] forState:UIControlStateNormal];
    [view addSubview:button];
    [view release];
}
//按钮点击事件
-(void)buttonAction:(UIButton *)sender{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
